The coolest way to generate combinations
نویسندگان
چکیده
We present a practical and elegant method for generating all (s, t)-combinations (binary strings with s zeros and t ones): Identify the shortest prefix ending in 010 or 011 (or the entire string if no such prefix exists), and rotate it by one position to the right. This iterative rule gives an order to (s, t)-combinations that is circular and genlex. Moreover, the rotated portion of the string always contains at most four contiguous runs of 0s and 1s, so every iteration can be achieved by transposing at most two pairs of bits. This leads to an efficient loopless and branchless implementation that consists only of two variables and six assignment statements. The order also has a number of striking similarities to colex order, especially its recursive definition and ranking algorithm. In light of these similarities we have named our order cool-lex !
منابع مشابه
The Coolest Order of Binary Strings
Pick a binary string of length n and remove its first bit b. Now insert b after the first remaining 10, or insert b at the end if there is no remaining 10. Do it again. And again. Keep going! Eventually, you will cycle through all 2 of the binary strings of length n. For example, are the binary strings of length n = 4, where 1 = and 0 = . Che bello! And if you only want strings with weight (num...
متن کاملConstrained Coolest Path Computation in Road Networks
Routing systems have become very attractive recently. They aim to help users on finding out the optimal path to their destinations regarding travel distance, travel time, and other criteria. This paper presents a distributed architecture for networking systems which proposes a new algorithm called Coolest path, which enables multi-criteria personalization based on travel distance, travel time, ...
متن کاملElectrical Lesion of Substantia Nigra Pars Compacta; An Alternative and Convenient Way to Generate the Animal Model of Parkinson’s Disease
The unilateral or bilateral lesion of the Substantia nigra pars compacta (SNc) by chemical neurotoxins such as 6-hydroxy dopamine (6-OHDA) or 1- Methyl-4- phenyl -1,2,3,6 – tetirahydro pyridine (MPTP) are the most commonly and the main used methods for generating the animal models of Parkinson’s disease (PD). But these agents are expensive, dangerous, difficult to use and inacce...
متن کاملClimate of the past millennium inferred from varved proglacial lake sediments on northeast Baffin Island, Arctic Canada
This study uses Pu-dated varved sediments from Big Round Lake, a proglacial lake on northeast Baffin Island, Arctic Canada to generate a 1000-year-long, annual-resolution record of past climate. Varve thickness is positively correlated with July–August–September temperature measured at Clyde River, 70 km to the north of the lake (r = 0.46, p \ 0.001). We therefore interpret the variability and ...
متن کاملA New Document Embedding Method for News Classification
Abstract- Text classification is one of the main tasks of natural language processing (NLP). In this task, documents are classified into pre-defined categories. There is lots of news spreading on the web. A text classifier can categorize news automatically and this facilitates and accelerates access to the news. The first step in text classification is to represent documents in a suitable way t...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Discrete Mathematics
دوره 309 شماره
صفحات -
تاریخ انتشار 2009